#!../../../common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1

if [ -s ./TEST_ENV ];then
    source ./TEST_ENV
fi

check_rms
rm=$RESOURCE_MANAGER

testname="libs/Mumps"

NODES=2
TASKS=4
ARGS=null

@test "[$testname] C (double precision) runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    EXE=./C_double
    if [ ! -s $EXE ];then
        flunk "$EXE binary does not exit"
    fi

    run_mpi_binary $EXE $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname] Fortran (single precision) runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    EXE=./F_single
    if [ ! -s $EXE ];then
        flunk "$EXE binary does not exit"
    fi

    run_mpi_binary $EXE $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname] Fortran (double precision) runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    EXE=./F_double
    if [ ! -s $EXE ];then
        flunk "$EXE binary does not exit"
    fi

    run_mpi_binary $EXE $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname] Fortran (complex) runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    EXE=./F_complex
    if [ ! -s $EXE ];then
        flunk "$EXE binary does not exit"
    fi

    run_mpi_binary $EXE $ARGS $NODES $TASKS
    assert_success
}

@test "[$testname] Fortran (double complex) runs under resource manager ($rm/$LMOD_FAMILY_COMPILER/$LMOD_FAMILY_MPI)" {
    EXE=./F_doublecomplex
    if [ ! -s $EXE ];then
        flunk "$EXE binary does not exit"
    fi

    run_mpi_binary $EXE $ARGS $NODES $TASKS
    assert_success
}

